<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var arr = [
		{
        "path": "/dashboard",
        "redirect": "/Dashboard/index",
        "unique": "1",
        "componentIden": "Layout",
        "menuTitle": "首页",
        "menuIcon": "ios-cog"
      },
      {
        "path": "/member",
        "unique": "2",
        "componentIden": "Layout",
        "menuTitle": "成员管理",
        "menuIcon": "ios-cog",
        "children": [
          {
            "path": "/admin",
            "unique": "2-1",
            "componentIden": "Admin",
            "menuTitle": "管理员管理",
            "menuIcon": "ios-cog"
          },
          {
            "path": "/user",
            "unique": "2-2",
            "componentIden": "User",
            "menuTitle": "用户管理",
            "menuIcon": "ios-cog"
          }
        ]
      },
      {
        "path": "/data",
        "unique": "3",
        "componentIden": "Layout",
        "menuTitle": "数据管理",
        "menuIcon": "ios-cog",
        "children": [
          {
            "path": "/way",
            "unique": "3-1",
            "componentIden": "Routers",
            "menuTitle": "路由管理",
            "menuIcon": "ios-cog"
          },
          {
            "path": "/picture",
            "unique": "3-2",
            "componentIden": "DataManage/picture",
            "menuTitle": "图片管理",
            "menuIcon": "ios-cog"
          },
          {
            "path": "/stautscode",
            "unique": "3-3",
            "componentIden": "DataManage/stautscode",
            "menuTitle": "HTTP状态码管理",
            "menuIcon": "ios-cog"
          }
        ]
      },
      {
        "path": "/resources",
        "componentIden": "Layout",
        "unique": "4",
        "menuTitle": "资源管理",
        "menuIcon": "ios-cog",
        "children": [
          {
            "path": "/system",
            "unique": "4-1",
            "componentIden": "System",
            "menuTitle": "系统设置",
            "menuIcon": "ios-filing"
          },
          {
            "path": "/download",
            "unique": "4-2",
            "componentIden": "Download",
            "menuTitle": "下载管理",
            "menuIcon": "ios-filing",
            "children": [
              {
                "path": "/pictureDown",
                "unique": "4-2-1",
                "componentIden": "PictureDown",
                "menuTitle": "图片下载",
                "menuIcon": "ios-filing"
              },
              {
                "path": "/files",
                "unique": "4-2-2",
                "componentIden": "Files",
                "menuTitle": "文件下载",
                "menuIcon": "ios-filing"
              }
            ]
          }
        ]
      }
    ];
	var nowM = {
		"path": "/pictureDown",
		"unique": "4-2-1",
		"componentIden": "PictureDown",
		"menuTitle": "图片下载",
		"menuIcon": "ios-filing"
	};
	var arrR = [];
	var unique_arr = [];
	var step2 = transfromRoute(arr, nowM);
	getCramus(arr, step2);
	function transfromRoute(arr, nowM){
		var a1 = nowM.unique.split('-')[0];
		var a2 = nowM.unique.substring(0,nowM.unique.length - nowM.unique.indexOf('-') -1);
		unique_arr.push(a1,a2,nowM.unique);
		console.log('最后输出', new Set(unique_arr));
		return Array.from(new Set(unique_arr));
	}
	function getCramus(arr,step2){
		for (var i = 0; i < arr.length; i++) {
			for (let var1 in step2) {
				if (arr[i].unique == step2[var1]) {
					var obj = {
						path: arr[i].path,
						title: arr[i].menuTitle,
						icon: arr[i].menuIcon,
						unique: arr[i].unique
					}
					arrR.push(obj);
				}
			}
			if (arr[i].hasOwnProperty('children') && arr[i].children.length > 0) {
				this.getCramus(arr[i].children, step2);
			}
		}
	}
console.log(arrR,'kkk');
		</script>
	</head>
	<body>
	</body>
</html>
